package com.aisino.nmg.util;

import java.io.File;

public class PathUtil {
	public static String getRootProjectPath(){
		File file = new File(PathUtil.class.getProtectionDomain().getCodeSource().getLocation().getFile());
		String classPath = file.getParentFile().getParentFile().getParentFile().getPath() + File.separator;
		classPath = classPath.replaceAll("%20", " ");

		return classPath;
	}

	public static String getCurrentProjectPath(Class<?> clazz){
		File file = new File(clazz.getProtectionDomain().getCodeSource().getLocation().getFile());
		String classPath = file.getParentFile().getParentFile().getPath() + File.separator;
		classPath = classPath.replaceAll("%20", " ");

		return classPath;
	}

	public static String getCurrentProjectPath(){
		File file = new File(PathUtil.class.getProtectionDomain().getCodeSource().getLocation().getFile());
		String classPath = file.getParentFile().getParentFile().getPath() + File.separator;
		classPath = classPath.replaceAll("%20", " ");

		return classPath;
	}
}
